package com.weibo.boot.springbootlearn.mq.kafka;

import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Component;

/**
 * @author panda
 * @version Id: KafkaProducer, v 0.1 2020/11/29 11:31 上午 Exp $
 * @description
 */
@Component
@Slf4j
public class KafkaProducer {

    private KafkaTemplate<String, Object> kafkaTemplate;

    public void send(Object ob) {
        kafkaTemplate.send("test_kafka", "test", JSON.toJSONString(ob));
    }
}
